//
//  PreviewItemsCell.m
//  ICrEAM
//
//  Created by Cty on 2016/10/31.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "PreviewItemsCell.h"


@implementation PreviewItemsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    UIView *sperator = [[UIView alloc]initWithFrame:CGRectMake(0, ActualHeight(79), ScreenWidth, 1)];
    sperator.backgroundColor = BackgroundColor_Gray;
    [self.contentView addSubview:sperator];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setViewWithObject:(ICMRepairMaintenanceModel *)model{
    self.itemName.text = model.LABOUR_NAME;
    self.itemCode.text = model.LABOUR_CODE;
    self.time.text = model.STD_LABOUR_HOUR;
    
    self.discountLabel.text = model.DISCOUNT_RATE;

    self.workPriceLabel.text = [NSString stringWithFormat:@"%.2f",[model.LABOUR_PRICE doubleValue]];
//    self.workPriceLabel.text = [self calculateWorkingHoursWithSERIES_LABOUR_PRICE:model.SERIES_LABOUR_PRICE andREPAIR_ITEM_TYPE_RATE:model.REPAIR_ITEM_TYPE_RATE andTECHNIC_MODULUS:model.TECHNIC_MODULUS];
    
    self.price.text =  [NSString stringWithFormat:@"%.2f",[model.LABOUR_AMOUNT doubleValue]];
//    self.price.text = [NSString stringWithFormat:@"%.2f",[model.STD_LABOUR_HOUR floatValue]*[self.workPriceLabel.text floatValue]];
    
    [self.time changeXToOtherX:ActualWidth(340)];
    [self.workPriceLabel changeXToOtherX:ActualWidth(480)];
    [self.price changeXToOtherX:ActualWidth(620)];
}


//算工时单价
//-(NSString *)calculateWorkingHoursWithSERIES_LABOUR_PRICE:(NSString *)SERIES_LABOUR_PRICE andREPAIR_ITEM_TYPE_RATE:(NSString *)REPAIR_ITEM_TYPE_RATE andTECHNIC_MODULUS:(NSString *)TECHNIC_MODULUS{
//    
//    double series_labour_price = [SERIES_LABOUR_PRICE floatValue];
//    double repair_item_type_rate = [REPAIR_ITEM_TYPE_RATE floatValue];
//    double texhnic_modulus = [TECHNIC_MODULUS floatValue];
//    
//    double workingHours = series_labour_price * repair_item_type_rate * texhnic_modulus;
//    
//    NSString *workingHoursStr = [NSString stringWithFormat:@"%.2f",workingHours];
//    
//    return workingHoursStr;
//}

@end
